import http from "@/common/http";
import brandListResponse from "@/apis/mock/brand.json";
import {BrandItem} from "@/common/interfaces/brand";

export async function queryBrand(params?: any, useMock?: boolean) {
  if (useMock) {
    return Promise.resolve(brandListResponse)
  }
  return http('/api/product/brand/list', {
    method: 'POST',
    data: {
      ...params,
    },
  });
}

export async function removeBrand(params: { ids: number[] }) {
  return http('/api/product/brand/delete', {
    method: 'POST',
    data: {
      ...params,
    },
  });
}

export async function addBrand(params: BrandItem) {
  return http('/api/product/brand/add', {
    method: 'POST',
    data: {
      ...params,
    },
  });
}

export async function updateBrand(params: BrandItem) {
  return http('/api/product/brand/update', {
    method: 'POST',
    data: {
      ...params,
    },
  });
}

